// Copyright (c) 2023 Wang Baisheng <baisheng_wang@163.com>, Wang Shenghan. All Rights Reserved.

#include "include/mm.h"
#include "include/print.h"
#include "include/sched.h"
#include "include/tss.h"
#include "include/interrupt.h"

int main()
{
    mm_init();
    interrupt_init();

    __asm__ ("sti");
    sched_init();
    tss_init();

    __asm__ ("mov %0, %%cr3": :"r"(current->pml4));

    // enable timer
    init_8254();

    // return to task1
    __asm__ ("movq %0, %%rsp\n\t"
             "jmp ret_from_kernel\n\t"
             :
             : "m"(current->rsp0)
            );
}
